<template>
	<div>
		<router-view />
		<van-tabbar v-model="active" @change="changeTabBar">
			<van-tabbar-item icon="home">首页</van-tabbar-item>
			<van-tabbar-item icon="chat" dot>消息</van-tabbar-item>
			<van-tabbar-item icon="contact">我的</van-tabbar-item>
		</van-tabbar>
	</div>
</template>
<script>
	import Vue from "vue";
	import {
		openWebview,
		openWebviewFast,
		preLoad,
		showWebviewById
	} from "@/utils/webview";
	import { request } from "@/utils/request";
	import {
		Icon,
		Tabbar,
		TabbarItem
	} from "vant";
	import Logo from "./components/logo.vue";
	import utils from "@/utils/Utils";
	import loadingMore from "./components/common/loadingMore.vue";
	export default {
		components: {
			Logo,
			[Icon.name]: Icon,
			[Tabbar.name]: Tabbar,
			[TabbarItem.name]: TabbarItem
		},
		created() {
			window.addEventListener("customEvent", function(event) {
				//通过event.detail可获得传递过来的参数内容
				plus.nativeUI.toast("我是首页,我很慌,我收到了信息");
				console.log(event.detail);
			});

			function plusReady() {
				let ws = plus.webview.currentWebview();
				console.log(ws);
			}
			if(window.plus) {
				plusReady();
			} else {
				document.addEventListener("plusready", plusReady, false);
			}
		},
		data() {
			return {
				activeName: "1",
				count: 0,
				isLoading: false,
				active: 0,
				list: [],
				loading: false,
				finished: false,
				show: false
			};
		},

		methods: {
			changeTabBar(index) {
				this.active = index;
				if(this.active == 0) {
					this.$router.push('/');
				} else if(this.active == 1) {
					this.$router.push('/msg');
				} else if(this.active == 2) {
					this.$router.push('/mine');
					//        if (this.isLogin()) {
					//
					//        }
				}
			},
		}
	};
</script>

<style lang="less">
	:global {
		body {
			background-color: #f8f8f8;
			-webkit-font-smoothing: antialiased;
			font-family: PingFang SC, Helvetica Neue, Arial, sans-serif;
		}
	}
</style>
